#include<iostream>
using namespace std;
int monthd[13] = { 0, 31,28,31,30,31,30,31,31,30,31,30,31 };
class date
{
	int _year;
	int _month;
	int _day;
public:
	date(int year = 2024, int month = 5, int day = 11)
	{
		_year = year;
		_month = month;
		_day = day;
	}
	int changeToDay()
	{
		int premonth = _month - 1;
		int ct = 0;
		for (int i = 0; i <= premonth; i++)
		{
			ct += monthd[i];
		}
		if (_month <= 2)
			return  _day + ct;
		if ((_year % 400 == 0) || (_year % 4 == 0 && _year % 100 != 0))
			return  _day + 1 + ct;
		return  _day + ct;
	}
};
int main()
{
	int year, month, day;
	cin >> year >> month >> day;
	class date d(year, month, day);
	cout << d.changeToDay();
	return 0;
}